package ua.kharkiv.karimov.knure.SummaryTask1.Airplanes;

public class Coord {
	private int x;
	private int y;
	private int z;

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getZ() {
		return z;
	}

	public void setZ(int z) {
		this.z = z;
	}

	public Coord(int x, int y, int z) {
		this.x = x;
		this.y = y;
		this.z = z;
	}

	public double lengthTo(Coord c2) {
		return Math.sqrt((x - c2.getX()) * (x - c2.getX()) + (y - c2.getY())
				* (y - c2.getY()) + (z - c2.getZ()) * (z - c2.getZ()));
	}

	@Override
	public String toString() {
		return x + "; " + y + "; " + z;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Coord) {
			Coord c = (Coord) obj;
			return c.x == x && c.y == y && c.z == z;
		}
		return false;
	}

}
